/**
 *
 */
package com.ybkj.daijia.common;


public class Pager {

    private final static ThreadLocal<Integer> OFFSET = new ThreadLocal();

    private final static ThreadLocal<Integer> LIMIT = new ThreadLocal();

    public static Integer getOffset() {
        return OFFSET.get();
    }

    public static void setOffset(Integer offset) {
        OFFSET.set(offset);
    }

    public static Integer getLimit() {
        return LIMIT.get();
    }

    public static void setLimit(Integer limit) {
        LIMIT.set(limit);
    }

    public static Integer getPage() {

        return OFFSET.get() / LIMIT.get();
    }

    public static void clear() {
        OFFSET.remove();
        LIMIT.remove();
    }
}
